﻿namespace AutoTest.Domain.Options
{

    /// <summary>
    /// 数据库配置
    /// </summary>
    public class DatabaseOption
    {
        /// <summary>
        /// 
        /// </summary>
        public DatabaseOption()
        {
            ConfigId = Guid.NewGuid().ToString("N");
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="configId"></param>
        public DatabaseOption(string configId)
        {
            this.ConfigId = configId;
        }
        /// <summary>
        /// 
        /// </summary>
        public string ConfigId { get; private set; } = string.Empty;
        /// <summary>
        /// 连字符串模板
        /// </summary>
        public string ConnectionFormat { get; set; } = string.Empty;
        /// <summary>
        /// 主机地址
        /// </summary>
        public string Host { get; set; } = string.Empty;
        /// <summary>
        /// 端口
        /// </summary>
        public int Port { get; set; } = 0;
        /// <summary>
        /// 数据库类型
        /// </summary>
        public string DBType { get; set; } = string.Empty;
        /// <summary>
        /// 数据库
        /// </summary>
        public string DBName { get; set; } = string.Empty;
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; } = string.Empty;
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; } = string.Empty;
        /// <summary>
        /// 模式
        /// </summary>
        public string Schema { get; set; } = string.Empty;

        /// <summary>
        /// 
        /// </summary>
        public int? HitRate { get; set; }
        /// <summary>
        /// 从库
        /// </summary>
        public List<DatabaseOption> Slaves { get; set; } = [];


    }

}
